fix: fix github to myst-parser admonition conversion#1224
Conversation
Signed-off-by: Terry Kong <terryk@nvidia.com>
Signed-off-by: Terry Kong <terryk@nvidia.com>
📝 WalkthroughWalkthroughAdds an in-place Markdown transformer for GitHub-style admonitions to MyST, introduces wrapper functions for Sphinx event hooks, and wires the transformation into both include-read and source-read events. Adjusts control flow to properly close code fences when replacements span multiple lines. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant S as Sphinx
participant IR as include-read event
participant SR as source-read event
participant W1 as _convert_gh_admonitions(...)
participant W2 as _convert_gh_admonitions_source(...)
participant T as _convert_gh_admonitions_inplace(...)
rect rgb(245,245,255)
Note over S: New flow
S->>IR: include-read(app, relative_path, parent_docname, contents)
IR->>W1: call
W1->>T: transform(contents)
T-->>W1: contents mutated
W1-->>IR: return
end
rect rgb(245,255,245)
S->>SR: source-read(app, docname, source)
SR->>W2: call
W2->>T: transform(source)
T-->>W2: source mutated
W2-->>SR: return
end
sequenceDiagram
autonumber
participant S as Sphinx
participant IR as include-read event
participant Old as _convert_gh_admonitions(...)
Note over S,Old: Prior flow (before change)
S->>IR: include-read(app, relative_path, parent_docname, contents)
IR->>Old: convert(contents)
Old-->>IR: contents mutated
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
docs/conf.py(3 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.py
📄 CodeRabbit inference engine (CODING_GUIDELINES.md)
**/*.py: Follow the Google Python Style Guide for all Python code
Target Python 3.12+ for all Python code in NeMo-RL
Indent Python code with 4 spaces; do not use tabs
Python filenames should be snake_case (e.g., some_file.py)
Class names should be PascalCase
Function and method names should be snake_case
Local variable names should be snake_case; if starting with a number, prefix with k (e.g., k_99th_percentile)
Global variables should be UPPER_SNAKE_CASE and prefixed with G_ (e.g., G_MY_GLOBAL)
Constants should be UPPER_SNAKE_CASE
Avoid shadowing variables declared in an outer scope
Initialize all externally visible members of a class in the constructor
For public interfaces used outside a file, prefer docstrings over comments
Use comments mainly for code within a function or interfaces local to a file
Commented-out code must include a nearby comment explaining usage and why it is commented out; otherwise remove before merging
Use Google-style docstrings for classes and functions (Sphinx-parseable)
Avoid using reflection when functionality can be easily achieved without it
Limit except clauses to the smallest specific set of exceptions possible
For duck-typing via try/except, keep the try body minimal and use else for main logic
Add the NVIDIA copyright header (with current year) at the top of all Python files, excluding tests/ and test-only scripts
Files:
docs/conf.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Docs_Tests
- GitHub Check: Lint check
- GitHub Check: Post submodule check comment / Comment on PR
- GitHub Check: Post automodel integration comment / Comment on PR
wangshangsam
left a comment
There was a problem hiding this comment.
Other than the comment CodeRabbit gave, LGTM
Signed-off-by: Terry Kong <terryk@nvidia.com>
|
FYI @aschilling-nv |
Signed-off-by: Terry Kong <terryk@nvidia.com> Signed-off-by: NeMo Bot <nemo-bot@nvidia.com>
Signed-off-by: Terry Kong <terryk@nvidia.com>
After #1070 , the admonition rewrite from github to the myst-parser format wasn't working correctly. This PR fixes.
{note}/{tip}etc., so MyST can render them correctly.Currently
After PR
Summary by CodeRabbit
Documentation
Bug Fixes